﻿using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS_Service.DomianService.Interface;

namespace WCS_Service
{
    /// <summary>
    /// WCS默认主服务
    /// </summary>
    public class WCSHostedManage : BackgroundService
    {
        private IWCSMainControlManage _wcsMainControlManage;
        public WCSHostedManage(IWCSMainControlManage wcsMainControlManage) 
        {
            _wcsMainControlManage = wcsMainControlManage;
        }

        protected async override Task ExecuteAsync(CancellationToken token)
        {
            try
            {
                await _wcsMainControlManage.InitWcsControlService();
            }
            catch (Exception ex) 
            {
                Log.Error($"WCS启动失败{ex.Message}");
            }
        }
    }
}
